home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 1 (Walnut Creek)
/
Aminet - June 1993 [Walnut Creek].iso
/
aminet
/
biz
/
demo
/
origins.lzh
/
ARexx
/
ATest.rexx
< prev
next >
Wrap
OS/2 REXX Batch file
|
1992-08-20
|
6KB
|
209 lines
/*********************************************/
/* ATest.rexx - test Origins ARexx interface */
/* */
/* ©1992 by The Puzzle Factory */
/*********************************************/
/* Make sure that you change the arguments to the functions to match
records in YOUR database before trying to use the functions. */
/* Tell ARexx we'll be expecting results */
Options Results
/* Enable error handling routins for syntax errors and Rexx errors */
Signal On Error
Signal On Syntax
Signal On Halt
Signal On IOErr
/* Setup my address */
MyPort = "GENREXX"
If (~Show('P',myport)) then do
Say "Please start the host application first."
Exit
End
Address value MyPort
Say "Testing GENSETSEARCH(SNAME,GNAME,YEAR,CITY,COUNTRY,CODE,GENDER)"
Say "==============================================================="
Call GENSETSEARCH('Doe','John',1955,'Toledo','USA',4,'M')
Say "Result:" RESULT
Say ""
Say "Testing GENCONVERTSOUNDEX(SNAME)"
Say "================================"
LASTNAME='Smith'
Call GENCONVERTSOUNDEX(LASTNAME)
Say "The Soundex representation of" LASTNAME "is" RESULT
Say ""
Say "Testing GENFINDPERSON(SEARCH)"
Say "============================="
Call GENFINDPERSON(SEARCH)
Say PERSON.RECORD
Say PERSON.FATHER ||', '|| PERSON.MOTHER
Say PERSON.SURNAME ||', '|| PERSON.GIVNAME
Say PERSON.SEX
Say PERSON.CODE
Say PERSON.BIRTHDATE ||', '|| PERSON.BIRTHCITY ||', '|| PERSON.BIRTHCOUNTY ||', '|| PERSON.BIRTHSTATE ||', '|| PERSON.BIRTHCOUNTRY
Say PERSON.DEATHDATE ||', '|| PERSON.DEATHCITY ||', '|| PERSON.DEATHCOUNTY ||', '|| PERSON.DEATHSTATE ||', '|| PERSON.DEATHCOUNTRY
Say PERSON.BURIALDATE ||', '|| PERSON.BURIALCITY ||', '|| PERSON.BURIALCOUNTY ||', '|| PERSON.BURIALSTATE ||', '|| PERSON.BURIALCOUNTRY
Say ""
Say "Testing GENFINDORDINANCE(SEARCH)"
Say "================================"
Call GENFINDORDINANCE(SEARCH)
Say ORDINANCE.RECORD
Say ORDINANCE.BAPTISM
Say ORDINANCE.CONFIRMATION
Say ORDINANCE.SPOUSE1 ||', '|| ORDINANCE.SPOUSE2 ||', '|| ORDINANCE.SPOUSE3
Say ORDINANCE.ARRIVED ||', '|| ORDINANCE.ARRDATE
Say ORDINANCE.OCCUPATION
Say ""
Say "Testing GENFINDMARRIAGE(SEARCH)"
Say "==============================="
Call GENFINDMARRIAGE(SEARCH)
If Result = 'Found marriage' then do
Say "Record #:" MARRIAGE.RECORD
Say "Husband: " MARRIAGE.HUSBAND
Say "Wife: " MARRIAGE.WIFE
Say "Code: " MARRIAGE.CODE
Say "Date: " MARRIAGE.DATE
Say "City: " MARRIAGE.CITY ||', County: '|| MARRIAGE.COUNTY || ', State: '|| MARRIAGE.STATE ||',Country: '|| MARRIAGE.COUNTRY
Say "Comment: " MARRIAGE.COMMENT
end
If DataType(word(Result,1))=NUM then do
Say Result
do i=1 to (word(Result,1))
Say "Spouse"i" is" MARRIAGE.SPOUSE.i
end i
end
Say ""
Say "Testing GENFINDMARRIAGE(HNUM,WNUM)"
Say "=================================="
Call GENFINDMARRIAGE(102,103)
Say "Record #:" MARRIAGE.RECORD
Say "Husband: " MARRIAGE.HUSBAND ||', Wife: '|| MARRIAGE.WIFE
Say "Code: " MARRIAGE.CODE
Say "Date: " MARRIAGE.DATE
Say "City: " MARRIAGE.CITY ||', County: '|| MARRIAGE.COUNTY ||', State: '|| MARRIAGE.STATE ||', Country: '|| MARRIAGE.COUNTRY
Say "Comment: " MARRIAGE.COMMENT
Say ""
Say "Testing GENFINDCHILDREN(FNUM,MNUM)"
Say "=================================="
Call GENFINDCHILDREN(58,61)
If value(word(Result,1))>0 then do /* If any children */
Say Result
do i=1 to (word(Result,1))
Say "Child"i" is" CHILD.i
end i
end
Say ""
Say "Testing GENFINDPARENTS(CNUM)"
Say "============================"
Call GENFINDPARENTS(132)
Say "Father is" FATHER
Say "Mother is" MOTHER
Say ""
Say "Testing GENADDPERSON(ARGS)"
Say "=========================="
/* Attempt to add new person record to database. */
Call GENADDPERSON(0,0,0,'Squirrel','Rocket J.','M',0,,
'03 Mar 1968','Frostbite Falls,,MN,USA','','','','')
Say Result
Say ""
/* Index existing parent/child relationships */
Say "Testing GENCREATEINDEX(PC)"
Say "=========================="
Call GENCREATEINDEX(PC)
Say Result
Say ""
Say "Testing GENADDORDINANCE(ARGS)"
Say "============================="
/* Attempt to add new ordinance record to database. */
Call GENADDORDINANCE(0,165,'Down by the riverside',,
'Our Lady of Perpertual Responsibility',49,2,0,,
'Steamship "Hosannah", stearage class','23 Sep 1903',,
'Part-time manure salesman')
Say Result
Say ""
Say "Testing GENADDMARRIAGE(ARGS)"
Say "============================"
/* Attempt to add new marriage record to database. */
Call GENADDMARRIAGE(0,5,6,14,'01 Jun 1946','Topeka','','Kansas','USA',,
'The weather was absolutely perfect for a June wedding')
Say Result
Say ""
/* Index existing marriage relationships */
Say "Testing GENCREATEINDEX(MARRIAGE)"
Say "================================"
Call GENCREATEINDEX(MARRIAGE)
Say Result
Say ""
Say "Testing GENAPPENDRECORDS(PERSON,1)"
Say "=================================="
/* Attempt to add 1 blank person record */
Call GENAPPENDRECORDS(PERSON,1)
Say RESULT
Say ""
Say "Testing GENGETNUMBER(PERSON)"
Say "============================"
/* Find out how many person records currently exist */
Call GENGETNUMBER(PERSON)
Say RESULT
Say ""
Say "Testing GENGETNUMBER(MARRIAGE,ACTIVE)"
Say "====================================="
/* Find out how many marriage records currently are in use */
Call GENGETNUMBER(MARRIAGE,ACTIVE)
Say RESULT
Say ""
Exit
/**********************************************************************/
/* Error Handling */
/**********************************************************************/
Error:
Parse Source Type Num MacroName Script Prog Port
say 'ERROR: Macro "'MacroName'", Error: #'RC' ("'ErrorText(RC)'") on line 'SIGL' **'
say ' Error string from Origins = "'GEN.LASTERROR'"'
exit
Syntax:
Parse Source Type Num MacroName Script Prog Port
say 'SYNTAX: Macro "'MacroName'", Error: #'RC' ("'ErrorText(RC)'") on line 'SIGL' **'
say ' Error string from Origins = "'GEN.LASTERROR'"'
exit
Halt:
Parse Source Type Num MacroName Script Prog Port
say 'HALT: Macro "'MacroName'", Error: #'RC' on line 'SIGL' **'
say ' Error string from Origins = "'GEN.LASTERROR'"'
exit
IOErr:
Parse Source Type Num MacroName Script Prog Port
say 'IOERR: Macro "'MacroName'", Error: #'RC' on line 'SIGL' **'
say ' Error string from Origins = "'GEN.LASTERROR'"'
exit